package com.xiao.exception;

import com.xiao.enums.AppHttpCodeEnum;
// 统一异常处理
public class SystemException extends  RuntimeException{
    private int code;// 异常代号
    private String msg;// 异常信息

    public int getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public SystemException(AppHttpCodeEnum appHttpCodeEnum) {// 用我们写好的枚举 规范异常信息
        super(appHttpCodeEnum.getMsg());// 调用父类 RuntimeException 的构造方法  public RuntimeException(String message)
        this.code = appHttpCodeEnum.getCode();
        this.msg =  appHttpCodeEnum.getMsg();
    }
}
